import numpy as np
import cv2

np.set_printoptions(suppress=True)
#通过函数变换，可以批量
src_points = np.array([
    [6336, 0],
    [6336, 9504]
], dtype='float32').reshape(-1, 1, 2)
M = np.array([[1,  -0.05, 32640.455],
              [0,  0.976, 24.26],
              [0,  0,  1]], dtype='float32')
tar_points = cv2.perspectiveTransform(src_points, M)
print(tar_points)
# tar_points
# [[[38976.453    24.26 ]]
#  [[38501.254  9300.164]]]
#单点通过矩阵变换
point = np.array([6336,0,1])
H = np.array([[1,-0.05,32640.455],[0,0.976,24.26],[0,0,1]])
point_new = np.dot(H,point)
print(point_new)
# -->
#[38976.455    24.26      1.   ]
